import { GuideTips } from "../view/guide/GuideTips";
import { TaskTargetInfo } from "../model/TaskTargetInfo";
import { TaskInfo } from "../model/TaskInfo";
import { GuideOptType } from "../rules/GuideOptType";
import { Language } from "../../../extend/language/Language";
import { HTMLUtil } from "../../../com/gengine/utils/HTMLUtil";
type int = number;
//class GuideTipsManager
    
    export  class GuideTipsManager
    {
        

        public static get guideTips(): GuideTips
        {
            if (!GuideTipsManager._guideTips) 
            {
                GuideTipsManager._guideTips = new GuideTips();
            }
            return GuideTipsManager._guideTips;
        }

        public static get guideTips2(): GuideTips
        {
            if (!GuideTipsManager._guideTips2) 
            {
                GuideTipsManager._guideTips2 = new GuideTips();
            }
            return GuideTipsManager._guideTips2;
        }

        public static get target(): TaskTargetInfo
        {
            return GuideTipsManager._target;
        }

        public static get task(): TaskInfo
        {
            return GuideTipsManager._task;
        }

        public static getGuideTips(arg1: int, arg2: string, arg3: TaskTargetInfo=null, arg4: TaskInfo=null, arg5: int=-1, arg6: int=-1, arg7: Boolean=true, arg8: Function=null, arg9: int=0): GuideTips
        {
            GuideTipsManager.hideGuideTips();
            GuideTipsManager._target = arg3;
            GuideTipsManager._task = arg4;
            GuideTipsManager._daily = arg9;
            if (arg7) 
            {
                if (arg3 && arg3.targetType == GuideOptType.GuideEquipComp) 
                {
                    guideTips.updateTxt(arg2);
                    guideTips.updateEquipComp(arg3.id);
                }
                else 
                {
                    guideTips.updateTxt(arg2);
                }
                guideTips.updateDir(arg1);
            }
            GuideTipsManager._callBack = arg8;
            if (GuideTipsManager._callBack != null) 
            {
                guideTips.updateCallBack(GuideTipsManager.onTipsClick);
            }
            guideTips.updateRect(arg5, arg6);
            if (GuideTipsManager._daily != 0) 
            {
                flash.utils.setTimeout(GuideTipsManager.onDailyTimeOut, GuideTipsManager._daily);
            }
            return guideTips;
        }

        public static getGuideTips2(arg1: int, arg2: string): GuideTips
        {
            GuideTipsManager.hideGuideTips2();
            guideTips2.updateTxt(arg2);
            guideTips2.updateDir(arg1);
            return guideTips2;
        }

        public static showGuideTipsAtLayer(arg1: Object /* flash.display.DisplayObjectContainer */, arg2: int, arg3: int, arg4: int, arg5: string): void
        {
            var loc1;
            (loc1 = GuideTipsManager.getGuideTips(arg4, arg5)).x = arg2;
            loc1.y = arg3;
            arg1.addChild(loc1);
            return;
        }

        /* internal  */static onDailyTimeOut(): void
        {
            GuideTipsManager.hideGuideTips();
            return;
        }

        /* internal  */static onTipsClick(): void
        {
            if (GuideTipsManager._callBack != null) 
            {
                if (!(GuideTipsManager._target == null) || !(GuideTipsManager._task == null)) 
                {
                    GuideTipsManager._callBack(GuideTipsManager._target, GuideTipsManager._task);
                }
                else 
                {
                    GuideTipsManager._callBack();
                }
            }
            return;
        }

        public static hideGuideTips(): void
        {
            if (GuideTipsManager._guideTips && !(GuideTipsManager._guideTips.parent == GuideTipsManager._thumbParent)) 
            {
                GuideTipsManager._thumbParent.addChild(GuideTipsManager._guideTips);
                GuideTipsManager._guideTips.dispose();
                GuideTipsManager._target = null;
                GuideTipsManager._task = null;
            }
            return;
        }

        public static hideGuideTips2(): void
        {
            if (GuideTipsManager._guideTips2 && !(GuideTipsManager._guideTips2.parent == GuideTipsManager._thumbParent)) 
            {
                GuideTipsManager._thumbParent.addChild(GuideTipsManager._guideTips2);
                GuideTipsManager._guideTips2.dispose();
            }
            return;
        }

        public static stageResize(): void
        {
            if (GuideTipsManager._guideTips && !(GuideTipsManager._guideTips.parent == GuideTipsManager._thumbParent)) 
            {
                if (GuideTipsManager._guideTips.baseLayer) 
                {
                    GuideTipsManager._guideTips.x = GuideTipsManager._guideTips.baseX + GuideTipsManager._guideTips.baseLayer.x;
                    GuideTipsManager._guideTips.y = GuideTipsManager._guideTips.baseY + GuideTipsManager._guideTips.baseLayer.y;
                }
            }
            return;
        }

        public static /* const */Dir_BL: int=1;

        public static /* const */Dir_BR: int=2;

        public static /* const */Dir_TL: int=3;

        public static /* const */Dir_TR: int=4;

        public static /* const */Txt_Fly: string=Language.getString(20323) + HTMLUtil.addColor(Language.getString(20324), "#00ff00") + Language.getString(20325);

        public static /* const */Txt_Dialog: string=Language.getString(20323);

        public static /* const */Txt_VIPFly: string=Language.getStringByParam(20326, HTMLUtil.addColor(Language.getString(20324), "#00ff00"));

        /* internal */ static /* var */_target: TaskTargetInfo;

        /* internal */ static /* var */_task: TaskInfo;

        /* internal */ static /* var */_guideTips: GuideTips;

        /* internal */ static /* var */_guideTips2: GuideTips;

        /* internal */ static /* var */_callBack: Function;

        /* internal */ static /* var */_daily: int;

        /* internal */ static /* var */_thumbParent: Object /* flash.display.Sprite */;
    }

            GuideTipsManager._thumbParent = new Object /* flash.display.Sprite */();
        